package com.edu.koTA07.adapter;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.edu.koTA07.takingOrder.R;

public class KategoriBarangListAdapter extends ArrayAdapter<String> {

	// private ImageLoader imageLoader;

	public KategoriBarangListAdapter(Activity activity, int textViewResourceId,
			List<String> listKategoriBarang) {
		super(activity, textViewResourceId, listKategoriBarang);
		inflater = (LayoutInflater) activity
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		// TODO Auto-generated constructor stub
//		activity.getResources();
		this.listKategoriBarang = listKategoriBarang;
	}

	private List<String> listKategoriBarang;
	private static LayoutInflater inflater = null;


	@Override
	public String getItem(int position) {
		return listKategoriBarang.get(position);
	}


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		String barang = listKategoriBarang.get(position);
		ViewHolder holder;
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.content_kategori_barang, null);
			holder = new ViewHolder();
			holder.textLine = (TextView) convertView.findViewById(R.id.textLine);
	       convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.textLine.setText(barang);
		return convertView;
	}

	class ViewHolder {
		TextView textLine;
	     ImageView iconLine;
	     Button buttonLine;
	}


}
